import json
import urllib.request

import jsonpath

url='https://dianying.taobao.com/cityAction.json?activityId&_ksTS=1744186709706_104&jsoncallback=jsonp105&action=cityAction&n_s=new&event_submit_doGetAllRegion=true'
headers = {
    "accept": "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript, */*; q=0.01",
    # "accept-encoding": "gzip, deflate, br, zstd",
    "accept-language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6",
    "bx-v": "2.5.28",
    "cookie": "thw=cn; cna=Deh7IDHGAGgCAXsOSKoLPpAm; t=027e4ab35abe06d8a5fdd2f05ef02d59; 3PcFlag=1744108589681; cookie2=18b7d01b531355b4d6bd0be22a119ee8; v=0; _tb_token_=5373e1e61983e; isg=BGxsup--J8nv7DP3jJKqLIjgPUqeJRDPONH5z8atHpe60Qzb7jVSXzBv8Znp3Egn",
    "priority": "u=1, i",
    "referer": "https://dianying.taobao.com/",
    "sec-ch-ua": "\"Chromium\";v=\"136\", \"Microsoft Edge\";v=\"136\", \"Not.A/Brand\";v=\"99\"",
    "sec-ch-ua-mobile": "?0",
    "sec-ch-ua-platform": "\"Windows\"",
    "sec-fetch-dest": "empty",
    "sec-fetch-mode": "cors",
    "sec-fetch-site": "same-origin",
    "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36 Edg/136.0.0.0",
    "x-requested-with": "XMLHttpRequest"
}
request=urllib.request.Request(url,headers=headers)
response=urllib.request.urlopen(request).read().decode('utf-8')
response=response.split('(')
response=response[1].split(')')[0]
obj=json.load(open('淘票票.json','r',encoding='utf-8'))
ans=jsonpath.jsonpath(obj,'$..regionName')
print(ans)
